<div class="row-fluid {$name}" >
    <table class="table table-striped table-hover table-bordered table-task">
        <thead>
	        <tr>
	            <th class="span5">{$tca.label}</th>
	        </tr>
        </thead>
        <tbody>
        <notempty name="tca[data]">
            <tr>
                <td class="answer">
                	<volist name="tca[data]" id="voo">
                           <div>
                               	{$tca.key}：<div class="input-append date form_date">
									            <input size="16" type="text" name="{$name}[0][]" value="{$voo[0]|date='Y-m-d',###}" readonly="readonly" class="m-wrap"  />
									            <span class="add-on"><i class="icon-remove"></i></span>
									            <span class="add-on"><i class="icon-calendar"></i></span>
									        </div><!-- <input style="margin-bottom: 3px;" type="text" class="span3 m-wrap" name="{$name}[0][]" value="{$voo[0]}"/> -->   
                    			{$tca.value}：<input style="margin-bottom: 3px;" type="text" class="baozhi" name="{$name}[1][]" value="{$voo[1]}"/>
                    			<a style="margin-top: 3px; margin-left: 5px;" class="btn add-answer" href="javascript:;"><i class="icon-plus"></i></a>
                    			<a style="margin-top: 3px; margin-left: 5px;" class="btn red remove-answer" data-id="{$voo.id}" href="javascript:;"><i class="icon-minus"></i></a>
                    			<!-- <span class="help-inline">{$tca.helpinfo}</span> -->
                           </div>
                    </volist>
                </td>
            </tr>
         <else />
            <tr>
                <td class="answer">
                    <div>
                    	{$tca.key}：<div class="input-append date form_date" style="margin-bottom: 3px;">
							            <input size="16" type="text" name="{$name}[0][]" value="" readonly="readonly" class="m-wrap"  />
							            <span class="add-on"><i class="icon-remove"></i></span>
							            <span class="add-on"><i class="icon-calendar"></i></span>
							        </div><!-- <input style="margin-bottom: 3px;" type="text" class="span3 m-wrap" name="{$name}[0][]" /> -->
                    	{$tca.value}：<input style="margin-bottom: 3px;" type="text" class="baozhi" name="{$name}[1][]" />
                    	<a style="margin-top: 3px; margin-left: 5px;" class="btn add-answer" href="javascript:;"><i class="icon-plus"></i></a>
                    	<a style="margin-top: 3px; margin-left: 5px;" class="btn red remove-answer" href="javascript:;"><i class="icon-minus"></i></a>
                    	<!-- <span class="help-inline">{$tca.helpinfo}</span> -->
                    </div>
                </td>
            </tr>
        </notempty>
        </tbody>
    </table>
</div>
<script src="__TMPL__Public/plugins/jquery-1.10.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
    jQuery(document).ready(function () {
    	//提货时间
		$(".add-answer").live("click", function(){
		    var cont_answer = '<div>'
		    					+'{$tca.key}：<div class="input-append date form_date" style="margin-bottom: 3px;">'
										        +'<input size="16" type="text" name="{$name}[0][]" value="" readonly="readonly" class="m-wrap"  />'
									            +'<span class="add-on"><i class="icon-remove"></i></span>'
									            +'<span class="add-on"><i class="icon-calendar"></i></span>'
									         +'</div>'
						      	+' {$tca.value}：<input style="margin-bottom: 5px;" type="text" class="baozhi" name="{$name}[1][]" />' +
		            		' <a style="margin-top: 3px; margin-left: 5px;" class="btn add-answer" href="javascript:;"><i class="icon-plus"></i></a>' +
		            		' <a style="margin-top: 3px; margin-left: 5px;" class="btn red remove-answer" href="javascript:;"><i class="icon-minus"></i></a></div>';

		    $(this).parents(".answer").append(cont_answer);
		    
		  	//将添加的日期控件初始化
            $(".answer .form_date input").datepicker({
                dateFormat: "yy-mm-dd",
                changeMonth: true,
                changeYear: true,
                showWeek: false
            });
            $('.answer .form_date .icon-calendar').click(function () {
                $(this).parents('.form_date').find('input').timepicker('show');
            });
            $('.answer .form_date .icon-remove').click(function () {
                $(this).parents('.form_date').find('input').val('');
            });
		});
		$(".remove-answer").live("click", function(){
		    var _this = $(this);
		    var id = $(this).data("id");
		    var url = "{:U('goods/delanswer')}";
		    if(id){
		        
		        custom_confirm('您确定要删除吗？', function (){
		        	$.post(url,{id:id},function(data){
			            if(data.status == 1){
			                _this.parent("div").remove();
			            }else{
			                alert(data.info);
			            }
			        },'json');
	            });
		        
		    }else{
		        if(_this.parent().parent().find(".remove-answer").length > 1){
		            $(this).parent("div").remove();
		        }
		    }
		});
		
		
    });
</script>